package com.org.web.api.unidemo;

import com.org.platform.model.ResultModel;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author duheng
 * @Date 2021/10/6 14:08
 */
@RestController
public class MobileDemoCategoryController {

	@RequestMapping(value = {"/mobile/uniapp/getCategory"})
	public ResultModel getCategory() {
		Map<String, Object> result = new HashMap<>();
		List<Map<String, Object>> flist = new ArrayList<>();
		// 菜单1
		Map<String, Object> oneFlist = new HashMap<>();
		oneFlist.put("id", 1);
		oneFlist.put("title", "菜单1");
		List<Map<String, Object>> childFlist = new ArrayList<>();
		Map<String, Object> childMap = new HashMap<>();
		childMap.put("id", 11);
		childMap.put("title", "菜单1-1");
		List<Map<String, Object>> theChildFlist = new ArrayList<>();
		Map<String, Object> theChildMap = new HashMap<>();
		theChildMap.put("id", 111);
		theChildMap.put("parentId", 11);
		theChildMap.put("title", "子菜单111");
		theChildMap.put("picUrl", "http://www.devg.cn/static/user-bg.jpg");
		theChildFlist.add(theChildMap);
		theChildMap = new HashMap<>();
		theChildMap.put("id", 112);
		theChildMap.put("parentId", 11);
		theChildMap.put("title", "子菜单112");
		theChildMap.put("picUrl", "http://www.devg.cn/static/user-bg.jpg");
		theChildFlist.add(theChildMap);
		theChildMap = new HashMap<>();
		theChildMap.put("id", 113);
		theChildMap.put("parentId", 11);
		theChildMap.put("title", "子菜单113");
		theChildMap.put("picUrl", "http://www.devg.cn/static/user-bg.jpg");
		theChildFlist.add(theChildMap);
		theChildMap = new HashMap<>();
		theChildMap.put("id", 114);
		theChildMap.put("parentId", 11);
		theChildMap.put("title", "子菜单114");
		theChildMap.put("picUrl", "http://www.devg.cn/static/user-bg.jpg");
		theChildFlist.add(theChildMap);
		childMap.put("childrenList", theChildFlist);
		childFlist.add(childMap);
		childMap = new HashMap<>();
		childMap.put("id", 12);
		childMap.put("title", "菜单1-2");

		theChildMap = new HashMap<>();
		theChildMap.put("id", 121);
		theChildMap.put("parentId", 12);
		theChildMap.put("title", "子菜单121");
		theChildMap.put("picUrl", "http://www.devg.cn/static/user-bg.jpg");
		theChildFlist.add(theChildMap);
		theChildMap = new HashMap<>();
		theChildMap.put("id", 122);
		theChildMap.put("parentId", 12);
		theChildMap.put("title", "子菜单122");
		theChildMap.put("picUrl", "http://www.devg.cn/static/user-bg.jpg");
		theChildFlist.add(theChildMap);
		theChildMap = new HashMap<>();
		theChildMap.put("id", 123);
		theChildMap.put("parentId", 12);
		theChildMap.put("title", "子菜单123");
		theChildMap.put("picUrl", "http://www.devg.cn/static/user-bg.jpg");
		theChildFlist.add(theChildMap);
		theChildMap = new HashMap<>();
		theChildMap.put("id", 124);
		theChildMap.put("parentId", 12);
		theChildMap.put("title", "子菜单124");
		theChildMap.put("picUrl", "http://www.devg.cn/static/user-bg.jpg");
		theChildFlist.add(theChildMap);
		theChildMap = new HashMap<>();
		theChildMap.put("id", 125);
		theChildMap.put("parentId", 12);
		theChildMap.put("title", "子菜单125");
		theChildMap.put("picUrl", "http://www.devg.cn/static/user-bg.jpg");
		theChildFlist.add(theChildMap);
		childMap.put("childrenList", theChildFlist);

		childFlist.add(childMap);
		childMap = new HashMap<>();
		childMap.put("id", 13);
		childMap.put("title", "菜单1-3");
		theChildMap = new HashMap<>();
		theChildMap.put("id", 131);
		theChildMap.put("parentId", 13);
		theChildMap.put("title", "子菜单131");
		theChildMap.put("picUrl", "http://www.devg.cn/static/user-bg.jpg");
		theChildFlist.add(theChildMap);
		theChildMap = new HashMap<>();
		theChildMap.put("id", 132);
		theChildMap.put("parentId", 13);
		theChildMap.put("title", "子菜单132");
		theChildMap.put("picUrl", "http://www.devg.cn/static/user-bg.jpg");
		theChildFlist.add(theChildMap);
		theChildMap = new HashMap<>();
		theChildMap.put("id", 133);
		theChildMap.put("parentId", 13);
		theChildMap.put("title", "子菜单133");
		theChildMap.put("picUrl", "http://www.devg.cn/static/user-bg.jpg");
		theChildFlist.add(theChildMap);
		theChildMap = new HashMap<>();
		theChildMap.put("id", 134);
		theChildMap.put("parentId", 13);
		theChildMap.put("title", "子菜单134");
		theChildMap.put("picUrl", "http://www.devg.cn/static/user-bg.jpg");
		theChildFlist.add(theChildMap);
		theChildMap = new HashMap<>();
		theChildMap.put("id", 135);
		theChildMap.put("parentId", 13);
		theChildMap.put("title", "子菜单135");
		theChildMap.put("picUrl", "http://www.devg.cn/static/user-bg.jpg");
		theChildFlist.add(theChildMap);
		childMap.put("childrenList", theChildFlist);
		childFlist.add(childMap);
		oneFlist.put("childrenList", childFlist);
		flist.add(oneFlist);

// 菜单2
		oneFlist = new HashMap<>();
		oneFlist.put("id", 2);
		oneFlist.put("title", "菜单2");
		childFlist = new ArrayList<>();
		childMap = new HashMap<>();
		childMap.put("id", 21);
		childMap.put("title", "菜单2-1");
		childFlist.add(childMap);
		childMap = new HashMap<>();
		childMap.put("id", 22);
		childMap.put("title", "菜单2-2");
		childFlist.add(childMap);
		childMap = new HashMap<>();
		childMap.put("id", 23);
		childMap.put("title", "菜单2-3");
		childFlist.add(childMap);
		oneFlist.put("childrenList", childFlist);
		flist.add(oneFlist);

// 菜单3
		oneFlist = new HashMap<>();
		oneFlist.put("id", 3);
		oneFlist.put("title", "菜单3");
		childFlist = new ArrayList<>();
		childMap = new HashMap<>();
		childMap.put("id", 31);
		childMap.put("title", "菜单3-1");
		childFlist.add(childMap);
		childMap = new HashMap<>();
		childMap.put("id", 32);
		childMap.put("title", "菜单3-2");
		childFlist.add(childMap);
		childMap = new HashMap<>();
		childMap.put("id", 33);
		childMap.put("title", "菜单3-3");
		childFlist.add(childMap);
		oneFlist.put("childrenList", childFlist);
		flist.add(oneFlist);

		result.put("flist", flist);
		return ResultModel.newSuccess(result);
	}
}
